package com.huixh.train.member.config;

import com.huixh.train.common.interceptor.LogInterceptor;
import com.huixh.train.member.interceptor.MemberInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author huixh
 */
@Configuration
public class MemberMvcConfig implements WebMvcConfigurer {
    @Resource
    private MemberInterceptor memberInterceptor;
    @Resource
    private LogInterceptor logInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor)
                .addPathPatterns("/**");
        registry.addInterceptor(memberInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/member/sendCode",
                        "/member/login");
    }
}
